{layout name="public/layout" /}
{include file='yxnavbar'}


{include file='../../plugin/shopplan/template/web/shopplan_common_nav'}
{if $system['is_shop_plan']==1}
<script type="text/javascript">
	function jump(){
		layer.msg('正在准备下载');
	}
function changeStore(){
    var themeid = $('#themeid option:selected').val();
	var postUrl = "{php echo createWebUrlPlugin('shopplan.show',array('themeid'=>$themeid));}";
        postUrl+='&themeid='+themeid;
    window.location.href = postUrl;
}
</script>
<div class="main">
		<div class="panel panel-info">
		<div class="panel-heading">当前搜索条件下 : <strong>{$total}</strong> 个</div>
		<div class="panel-body" style="position: relative;">
					
                    {if count($themelist)>1 }
                    <div class="col-xs-12 col-sm-2 col-md-2" style="position: absolute;top: 10px;right: 10px">
                        <select onchange="changeStore();" class="form-control" name="themeid" id="themeid">
                            {loop $themelist $row}
                            <option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
                            {/loop}
                        </select>
                    </div>
                    {else}
                    <input type="hidden" name="themeid" value="{$themeid}" />
                    {/if}
		<form id = "myform" action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
			<input type="hidden" name="m" value="{$_P['m']}" />
			<input type="hidden" name="do" value="web" />
			<input type="hidden" name="r" value="shopplan.show" />
			<input type="hidden" name="themeid" value="{$themeid}" />				
			<label class="col-xs-1 col-sm-1 col-md-1 control-label"></label>	
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-1 control-label">分店查询</label>
				<div class="col-xs-9 col-sm-9 col-md-9">				
					<div class="btn-group">
						<select name="shopid"  id="mySelect">
								<option  selected value="all">全部店铺</option>
							{loop $shopconfig $k $item}
								<option value="{$item['shopid']}" {if $item['shopid']== $shopid}selected{/if}>{$item['name']}</option>
							{/loop}
						</select>
					</div>
				</div>
			</div>
			<label class="col-xs-1 col-sm-1 col-md-1 control-label"></label>	
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-1 control-label">用户信息</label>
				<div class="col-xs-9 col-sm-9 col-md-9">							
					<div class="btn-group">
						<input  class="form-control" name="search_data" placeholder="输入姓名、电话、微信昵称、uid" type="text" value="{$_P['search_data']}">
					</div>
				</div>
			</div>
			<label class="col-xs-1 col-sm-1 col-md-1 control-label"></label>	
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-1 control-label">预约的起止时间</label>
				<div class="col-xs-9 col-sm-9 col-md-9">							
					<div class="btn-group">
						{php echo view_form_field_daterange('plantime', array('start' => $start_day, 'end' => $end_day));}
						
						<!--<input name="submit" id="btn_submit" type="submit" value="搜索" class="btn btn-default" style="background-color:#428bca;padding: 5px 15px; color: white;border-radius:5px; margin-left:50px;">-->
					<div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
						<input type="hidden" name="__token__" value="{$Request.token}"/>
					</div>
						<div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
							<input class="btn btn-default" type="submit" name="export_submit" onclick="jump()" id="export_submit" value="导出EXCEL" style=" margin-left:50px;">
							<input type="hidden" name="type" value="{$type}"/>
						</div>
					</div>		
				</div>	
			</div>
			</form>	

		<span class="help-block" style='float: right'>
			<a style="background-color:#428bca;padding: 8px 20px; color: white;border-radius:8px;" href="{php echo createWebUrlPlugin('shopplan.adplan',array('themeid'=>$themeid,'op'=>'offline'));}">手工添加客户预约</a>
		</span>
		</div>		
   </div>
	</div>
	<form class="form-horizontal" action="" method="post" id="form-goods">
		<div class="panel panel-default">
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
						<tr>
							<th>预约号</th>
                            <!--<th>用户uid</th>-->
							<th>昵称</th>
							<th>姓名/电话</th>
							<!--<th>活动id</th>-->
							<th>预约的分支店铺</th>
							<th>预约日期</th>
							<th>预约时间</th>
							{if $agelimit == 1}
								<th>用户生日</th>
							{/if}
							<th>员工姓名/电话</th>
							<th>留言备注</th>
							<th>操作时间</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						{loop $list $key $userplan}
                        <tr>
                            <td>{$userplan['id']}</td>
							<!--<td>{$userplan['uid']}</td>-->
							<td><img src="{php echo tomedia($userplan['avatar']);}" width="28" style="border-radius: 3px;"><br>{$userplan['nickname']}</td>
							<td>{php echo $userplan['username']?$userplan['username']:$userplan['offline_username'];}<br>{php echo $userplan['mobile']?$userplan['mobile']:$userplan['offline_mobile'];}</td>
							<!--<td>{$userplan['storeid']}</td>-->
							<td>{$userplan['shopname']}</td>
							<td>{$userplan['p_date']}</td>
							<td>{$userplan['p_time']}</td>
							{if $agelimit == 1}
								<td>{$userplan['birthday']}</td>
							{/if}
							{if $userplan['worker_name'] || $userplan['worker_mobile']}
								<td>{$userplan['worker_name']}<br>{$userplan['worker_mobile']}</td>
							{else}
								<td>——</td>
							{/if}
							<td>{$userplan['note']}</td>
							<td>{$userplan['created_at']}</td>
                            <td>
								<!-- <a style="background-color: #5cb85c; padding: 3px 10px;border-radius:5px; text-align:center;color: white;" href="{php echo createWebUrlPlugin('shopplan.editplan',array('id'=>$userplan['id']));}">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp; -->
								<!-- <a style="background-color: #ca4242; padding: 3px 10px;border-radius:5px; text-align:center;color: white;" href="{php echo createWebUrlPlugin('shopplan.delplan',array('id'=>$userplan['id']));}" onclick="if(!confirm('删除后将不可恢复，确定删除吗?')) return false;">删除</a> -->





								<div class="btn-group">
									<a href="{php echo createWebUrlPlugin('shopplan.editplan',array('id'=>$userplan['id']));}" class="btn btn-success btn-sm" style="width: 35px"><i class="fa fa-gavel"> </i></a>		
								</div>
								<div class="btn-group">
									<a href="{php echo createWebUrlPlugin('shopplan.delplan',array('id'=>$userplan['id']));}" class="btn btn-danger btn-sm" style="width: 35px" onclick="if(!confirm('删除后将不可恢复，确定删除吗?')) return false;"><i class="fa fa-times"> </i></a>		
								</div>				
							</td>
                        </tr>
                        {/loop}
					</tbody>
				</table>
			</div>
		</div>
		
		{$pager}
	</form>
</div>






{/if} 
